import Vue from 'vue'
import VueRouter from 'vue-router'


//导入组件
const Home = () => import('../views/home/Home')
const Profile = () => import('../views/profile/profile')
const Cart = () => import('../views/cart/cart')
const Category = () => import('../views/category/categroy')


//1 : 安装插件
Vue.use(VueRouter)

// 2 : 创建路由对象
const routes = [
    //默认页面
    {
        path: '',
        redirect: "/home"

    },
    {
        path: '/home',
        component: Home
    },
    {
        path: '/profile',
        component: Profile
    },
    {
        path: '/cart',
        component: Cart
    },
    {
        path: '/category',
        component: Category
    }
]

const router = new VueRouter({
    routes
})

//导出router
export default router
